<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
com.jxtti.model.User userInfo = com.jxtti.utils.AuthUtil.getUserInfo(request);
String orgId=null;
if(userInfo.getDistrictId()==null || userInfo.getDistrictId().equals("0")){ //非超管
	orgId=userInfo.getOrgId().toString();
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=9" />
		<meta http-equiv="pragma" content="no-cache" />
		<title>咨询互动信息</title>
		<%@ include file="../../common/Admin-list.jsp"%> 		
		<script type="text/javascript" src="<%=bpath %>Scripts/jquery/jquery.form.js"></script> 			 
		<script type="text/javascript">	
				
		$(function(){
			
			$('#task_org_id').combotree({
				 url:"../district/findByPidAll.json",
				 panelHeight:'300', 
	             editable: true , 
	             onClick:function(node){
					 $("#task_org_name").val($("#task_org_id").combotree("getText"));
					 $("#replyTr").css('display','none');					 
				 },
				 onLoadSuccess :function(){
			        $('#task_org_id').combotree("setValue",'${data.advisoryMsg.task_org_id}');//这里写设置默认值，
			     }
			});
			
			if('${data.advisoryMsg.typeId}'!=null && '${data.advisoryMsg.typeId}'==1){
				$("#polluteType").val('${data.advisoryMsg.polluteType}');
				$("#polluteType").attr("disabled","disabled");
				
				$("#lblTitle").text("污染投诉--任务分派");
			}
			
			if(<%=orgId %>!=null){ //非管理员
				$("#task_org_id").combotree("setValue",<%=orgId %>);	
				$("#task_org_id").combotree('disable');
			}
			
			$('#noTaskOrgId').click(function(){
				$('#task_org_id').combotree('clear');
				$("#replyTr").css('display','');
				$('#task_org_name').val("");				
			});
			
			//保存 
			$("#lnbSave").click(function(){		
				$("#addForm").ajaxSubmit({
					url:"../advisoryMsgController/update.json",
					type:"POST",
					dataType:"json",
					beforeSubmit:checkForm,
					contentType:"application/x-www-form-urlencoded;charset=UTF-8",
					error:function(){},
					success:function(data){
						if(data.success==true){
							showTip("保存成功，返回列表页面！","succeed");								
						}else{
							art.dialog.alert('保存失败，请确认填写正确！');
						}
					}
				});
			});
			
		});
			
		function checkForm(){
			var flag=$('#addForm').form('validate');
			return true;
		}
				
		//消息提示  
		function showTip(mess,icon) {  
		    art.dialog({  
		        id : 'Tip',  
		        title : '消息',  
		        fixed : true,  
		        lock : true,  
		        opacity: .2,  
		        content : mess,  
		        icon : icon,  
		        time : 1  
		    });  
		    setTimeout('originReload()', 1000);  
		}  
		
		//重载来源页面  
		function originReload(){  
		    var win = art.dialog.open.origin;		    
		    win.location.reload();  
		}
		
		</script>
		
</head>
<body style="overflow: scroll;">
<!---->
<div>
	<div id="tab">
        <ul>
            <li class="Current">
            	<a href="#" onfocus="this.blur()">
            		<span id="lblTitle" >咨询留言--任务分派  </span>
            	</a>
            </li>
        </ul>
    </div>  
    <div id="menu">
        <ul>
            <li>
            	<a id="lnbSave">
            		<span><img src="<%=basePath %>pages/Admin/Images/Icon/save.gif" alt="Save" />保存</span>
            	</a>
            </li>
        </ul>
    </div>
    
    <div id="middle"> 
    	<!-- 咨询详情 -->
    	<div class="mailinfo">
      		<div class="mailbt">
      		<c:if test= "${data.advisoryMsg.typeId!=null && data.advisoryMsg.typeId==0}" >
      			咨询留言
      		</c:if>
      		<c:if test= "${data.advisoryMsg.typeId!=null && data.advisoryMsg.typeId==1}" >
      			投诉举报
      		</c:if>
      		 --详情</div>
      		<table width="100%" cellspacing="1" cellpadding="0" border="0" bgcolor="#CCCCCC" align="center">
       		<tbody>
       		     <tr>
                    <td width="15%" class="tdRight">日期：</td>
                    <td width="82%">
                    		${data.advisoryMsg.createTime}                    		
                    		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    		<label class="tdRight">查询号：</label>${data.advisoryMsg.searchId}
                    </td>
                </tr>
                
                <tr>
                	<td width="15%" class="tdRight">咨询人：</td>
                    <td width="82%" >
                    	${data.advisoryMsg.ad_name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    	<label class="tdRight">身份证号码：</label>${data.advisoryMsg.ad_iDcards}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    	<label class="tdRight">手机号码：</label>${data.advisoryMsg.ad_tel }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    	<label class="tdRight">电子邮箱：</label>${data.advisoryMsg.ad_email }
                    </td>
                </tr>
                
                <tr>
                	<td class="tdRight">主题：</td>
                    <td>${data.advisoryMsg.title}</td>
                </tr> 
                <tr>
                	<td class="tdRight">是否公开：</td>
                    <td>
                    	<c:if test= "${data.advisoryMsg.is_publish_ad!=null && data.advisoryMsg.is_publish_ad==0}" >
      						不公开
      					</c:if>
      					<c:if test= "${data.advisoryMsg.is_publish_ad!=null && data.advisoryMsg.is_publish_ad==1}" >
      						公开
      					</c:if>
                    </td>
                </tr>       
               <c:if test= "${data.advisoryMsg.typeId!=null && data.advisoryMsg.typeId==1}" >
	      		<tr>
                	<td class="tdRight">污染类型：</td>
                    <td>
                    	<select id="polluteType" name="polluteType">
                            <option value="0" selected="selected">请选择投诉类型</option>
                            <option value="0101">水污染</option>
                            <option value="0102">大气污染</option>			                            	 
							<option value="0103">固体废物</option>
							<option value="0104">噪声污染</option>
							<option value="0105">危险化学品</option>
							<option value="0106">放射性污染</option> 
							<option value="0107">电磁辐射</option>
							<option value="0108">三产污染</option>
							<option value="0109">生态破坏</option>
							<option value="0110">畜牧、农药化肥污染</option> 
							<option value="0111">其他污染</option>
                        </select>  
                    </td>
                </tr> 
	      		</c:if> 
	      		<tr>
                    <td class="tdRight" valign="top">通讯地址：</td>
                    <td>${data.advisoryMsg.ad_address}</td>
                </tr>                
                <tr>
                    <td class="tdRight" valign="top">内容：</td>
                    <td>${data.advisoryMsg.contents}</td>
                </tr>                                                    
      		</tbody>
      		</table>     
    	</div>
    
    	<!-- 回复 -->
    	<div class="mailinfo" style="margin-bottom:30px;">
      		<div class="mailbt">
	      		<c:if test= "${data.advisoryMsg.typeId!=null && data.advisoryMsg.typeId==0}" >
	      			咨询留言--
	      		</c:if>
	      		<c:if test= "${data.advisoryMsg.typeId!=null && data.advisoryMsg.typeId==1}" >
	      			投诉举报--
	      		</c:if>
	      		<c:choose> 
  					<c:when test="${data.advisoryMsg.states=='0'}">
  						待回复
  					</c:when> 
  					<c:when test="${data.advisoryMsg.states=='1'}">       
  						已分配
  					</c:when> 
				  	<c:otherwise> 				
				    	已回复 
				  	</c:otherwise> 
				</c:choose> 
      		</div>
      		<form action="../advisoryMsgController/update.json" id="addForm" name="addForm" method="post" >    
      		<table width="100%" cellspacing="1" cellpadding="0" border="0" bgcolor="#CCCCCC" align="center">
       		<tbody>
       			<tr class="eTr">
                	<td width="15%" class="tdRight">
                    	<label id="Label1" >分派到部门：</label>
                	</td>
                	<td  width="82%">
                		<select id="task_org_id" name="task_org_id" class="easyui-combotree"  style="width:250px;" ></select>
                		<%if(orgId==null){%>
                			&nbsp;&nbsp;<label id="noTaskOrgId" style="color:blue;">取消分派</label>
                		<%}%>
                		<input id="task_org_name" name="task_org_name" type="hidden" value="${data.advisoryMsg.task_org_name}" ></input>
					</td>
            	</tr>
                <tr id="replyTr">
                	<td class="tdRight" valign="top">
                    	<label id="Label1" >回复内容：</label>
                	</td>
                	<td>
                		<input type="hidden" id="id" name="id" value="${data.advisoryMsg.id }"/>            
						<textarea rows="5" style="height:150px;" id="reply_content" name="reply_content">${data.advisoryMsg.reply_content}</textarea>
					</td>
            	</tr>                                      
      		</tbody>
      		</table>  
      		</form>    
    	</div>  
    </div>
</div>
</body>
</html>